Let’s make sure we understand installing R, and calling libraries.
library(ggplot2)
library(plotly)
myplot <- ggplot(subset(GSS2014,
!is.na(health)), # health is not missing
aes(x = health, # x is health
y = coninc, # y is income
color = health)) + # color is health
geom_jitter() + # draw jittered points
geom_boxplot() + # draw boxplots
labs(title = "Health And Income",
y = "Income in Constant $",
x = "Health")
ggplotly(myplot)We use both the codebook and data set.
# local file
# make sure you are in the right directory
# Menu: Session | Set Working Directory
load("GSS2014.Rdata") Menu option as well
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 369.5 17551.2 33255.0 48603.3 60967.5 160742.2 224
## vars n mean sd median trimmed mad min max range
## X1 1 2314 48603.29 43340.89 33255 40902.37 28760.59 369.5 160742.2 160372.7
## skew kurtosis se
## X1 1.42 1.34 900.98